package icu.d4peng.cloud.common.message.properties;

import com.alibaba.fastjson.JSON;
import org.springframework.boot.autoconfigure.mail.MailProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

/**
 * @author d4peng
 * @version 1.0.0
 * @date 2021-12-27 15:40
 * @description EmailProperties:邮件的配置属性
 */
@ConfigurationProperties(prefix = EmailProperties.PREFIX)
public class EmailProperties extends MailProperties {
    /**
     * 前缀名
     */
    public static final String PREFIX = "roc.email";
    /**
     * 是否开启:默认开启
     */
    private Boolean enabled = Boolean.TRUE;
    /**
     * 模板位置前缀
     */
    private String templatePrefix = "template/";
    /**
     * 模板位置前缀
     */
    private String templateSuffix = ".html";

    public Boolean getEnabled() {
        return enabled;
    }

    public EmailProperties setEnabled(Boolean enabled) {
        this.enabled = enabled;
        return this;
    }

    public String getTemplatePrefix() {
        return templatePrefix;
    }

    public EmailProperties setTemplatePrefix(String templatePrefix) {
        this.templatePrefix = templatePrefix;
        return this;
    }

    public String getTemplateSuffix() {
        return templateSuffix;
    }

    public EmailProperties setTemplateSuffix(String templateSuffix) {
        this.templateSuffix = templateSuffix;
        return this;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
